#!/usr/bin/env bash
# This enables scripting the otherwise interactive execution of bochs.

function do_run {
# Sends contents of the following here-document to stdin of the make command (and bochs)
cat << EOF | make 2>&1 | sed -ne '/Booting/,/Quit/p'      
6
c
q
EOF
}

# Make sure we can compile before we try to start bochs
make kernel && do_run
